﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace pkufi_tools
{
    public class WebApiUtil
    {
        public WebApiUtil()
        {
            this.transHeader = new Header();
        }

        private Header _transHeader;
        /// <summary>
        /// 返回头,固定的5个字段.每次使用的时候注意transType、transResultCode、transResultDesc的设置
        /// </summary>
        public Header transHeader
        {
            get { return _transHeader; }
            set { _transHeader = value; }
        }

        private object _transResponse;
        /// <summary>
        /// 返回体,每个报文的返回内容不同,因此需要自定义JObject
        /// </summary>
        public object transResponse
        {
            get { return _transResponse; }
            set { _transResponse = value; }
        }

        private object _transRequest;
        /// <summary>
        /// 请求体,每个报文的请求内容不同,因此需要自定义JObject
        /// </summary>
        public object transRequest
        {
            get { return _transRequest; }
            set { _transRequest = value; }
        }
    }
    public class Header
    {
        public Header()
        {
            this.requestTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            this.requestId = Guid.NewGuid().ToString("N");
        }

        private string _requestTime;
        /// <summary>
        /// 请求时间
        /// </summary>
        public string requestTime
        {
            get { return _requestTime; }
            set { _requestTime = value; }
        }

        private string _transType;
        /// <summary>
        /// 交易类型,编码字典使用方正的接口编码字典
        /// </summary>
        public string transType
        {
            get { return _transType; }
            set { _transType = value; }
        }

        private string _requestId;
        /// <summary>
        /// 交易结果  1:成功,0失败
        /// </summary>
        public string requestId
        {
            get { return _requestId; }
            set { _requestId = value; }
        }

        private string _transResultCode;
        /// <summary>
        /// 交易结果  1:成功,0失败
        /// </summary>
        public string transResultCode
        {
            get { return _transResultCode; }
            set { _transResultCode = value; }
        }

        private string _transResultDesc;
        /// <summary>
        /// 交易结果描述
        /// </summary>
        public string transResultDesc
        {
            get { return _transResultDesc; }
            set { _transResultDesc = value; }
        }

        private string _preferLangId;
        /// <summary>
        /// 中英文标识
        /// </summary>
        public string preferLangId
        {
            get { return _preferLangId; }
            set { _preferLangId = value; }
        }
    }
}
